@echo on
echo Calculate file hashes
rem $Id$

if "%1"=="" (
  set basename=%computername%
) else (
  set basename=%1
)
set listing=%basename%.lst

if not exist %listing% exit
set result=%~d0%~p0%basename%.hsh
echo off > %result%
for /F "delims=" %%i in (%listing%) do (
  if exist %%i (
    %%~di
    cd "%%~pi"
    echo %%~ti %%~zi %%i >> %result%
    fsum.exe -edonkey -jnc "%%~ni%%~xi" >> %result%
  )
)
%~d0
cd "%~p0"
del %listing%
